package io.xxx.mario.wechaty;

import okhttp3.OkHttpClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;

@Configuration
@EnableConfigurationProperties(RobotProperties.class)
public class RobotAutoConfiguration {

    @Bean
    public RobotClient robotClient(
            @NonNull RobotProperties properties,
            OkHttpClient httpClient
    ) {
        String host = properties.getHost();
        Integer port = properties.getPort();
        return new RobotClient(host, port, httpClient);
    }
}
